<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
		<link rel="stylesheet" type="text/css" href="./scripts/estilo.css" />
		<title>Castrucci Maps - 2009 Beta Test</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA9N7ZgI7iRfg1ef5wnMehwRQhcxyI6suOmhv7ZUux0CU50zAeOhQdtA5eVQ3zn2c5FQswxnoGuS-BEA" type="text/javascript"></script>
    <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0" type="text/javascript"></script>
    <script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>    
    <script type="text/javascript">
	var width;
	var height;
		
	//captura a largura da janela 
	width = (parseInt(document.documentElement.clientWidth)-40); 	
	//captura a altura da janela 
	height = (parseInt(document.documentElement.clientHeight)-30); 	
		
	function initialize() 
	{
		if (GBrowserIsCompatible()) 
		{
			// Define Maps Settings
			var map = new GMap2(document.getElementById("map_canvas"), {size: new GSize(width,height)}); 			
			map.setCenter(new GLatLng(-23.9625, -46.3230), 16);                    								
			map.setUIToDefault();						
			map.setMapType(G_HYBRID_MAP); 			
			map.addControl(new GMapTypeControl());			
			//map.openInfoWindow(map.getCenter(),document.createTextNode("Casa do pedrinho...")); 			
			map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(5,15)));
			
			// Create a base icon for all of our markers that specifies the shadow, icon dimensions, etc.					
			var baseIcon = new GIcon(G_DEFAULT_ICON);
			baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
			baseIcon.iconSize = new GSize(20, 34);
			baseIcon.shadowSize = new GSize(37, 34);
			baseIcon.iconAnchor = new GPoint(9, 34);
			baseIcon.infoWindowAnchor = new GPoint(9, 2);
			
			// Creates a marker whose info window displays the letter corresponding to the given index.
			function createMarker(point, index)
			{  
				// Create a lettered icon for this point using our icon class  				
				var letter = String.fromCharCode("A".charCodeAt(0) + index);
				var letteredIcon = new GIcon(baseIcon);  				
				letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";  
				//letteredIcon.image = "http://www.iconesbr.net/iconesbr/2009/07/8453/8453_32x32.png"
				
				// Set up our GMarkerOptions object  
				markerOptions = { icon:letteredIcon };
				var marker = new GMarker(point, markerOptions);
				GEvent.addListener
				(
					marker, "click", function() 
					{
						marker.openInfoWindowHtml("Marker <b>" + letter + "</b>");
					}
				);
				return marker;
			}								
			
			var latlng = new GLatLng(-23.96855818574154, -46.323004961013794);		  
			map.addOverlay(createMarker(latlng, 6));

			var encodedPolyline = new GPolyline.fromEncoded(
			{
				color: "BLUE",
				weight: 10,
				points: "bjhqCjnvyGwBy@eFgCyC_A}Bc@iCCNyE`Ld@MxFi@hJvc@zBeHdVuHz^u@fF_DjVw@tMkAxh@EnCTzBCt@fBrW`AdOEpCaAfFFlE\rFhCtRx@xG",
				levels: "BBBBBBBBBBBBBBBBBBBBBBBBBBBB",
				zoomFactor: 32,
				numLevels: 4
			}
			);
			map.addOverlay(encodedPolyline);			
			
			GEvent.addListener(map,"click", function(overlay,latlng) 
			{
				if (overlay) 
				{
					// ignore if we click on the info window
					return;
				}
	  
				var tileCoordinate = new GPoint();
				var tilePoint = new GPoint();
				var currentProjection = G_NORMAL_MAP.getProjection();
				tilePoint = currentProjection.fromLatLngToPixel(latlng, map.getZoom());
				var myHtml = "<br/>Latitude: " + latlng.lat() + "<br/>Longitude: " + latlng.lng();	
				map.openInfoWindow(latlng, myHtml);
			}
			);						
		}
	}	
	GSearch.setOnLoadCallback(initialize);			
    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()">
    <div class="map" id="map_canvas"></div>
  </body>
</html>